package com.developpez.rpouiller.testsjunit4;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileDescriptor;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;

import org.apache.tools.ant.Task;
public class Random extends Task {
private static int min;
private static int max;
private static String location;

public void setMin(int min) {
this.min = min;
}
public void setMax(int max) {
this.max = max;
}

public void setMax(String loc) {
this.location = loc;
}

public void execute ()  {
	int resultat = (int) (Math.random() * (max-min)-min);
	System.out.println("Valeur du nombre entier aléatoire : " + resultat);
	
	FileWriter auteur;
	try {
		auteur = new FileWriter("/hometu/etudiants/E084722P/LpSil/techDev/projet-pour-tpAnt/"+this.location);
		BufferedWriter monTampon = new BufferedWriter(auteur);
		monTampon.write("Voici le nombre enregistré : " + resultat);
		monTampon.close();
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	
}
}

